package net.lab1024.sa.admin.module.business.erp.prp.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.module.business.erp.prp.domain.form.PrpordAddForm;
import net.lab1024.sa.admin.module.business.erp.prp.domain.form.PrpordQueryForm;
import net.lab1024.sa.admin.module.business.erp.prp.domain.form.PrpordUpdateForm;
import net.lab1024.sa.admin.module.business.erp.prp.domain.vo.PrpordVO;
import net.lab1024.sa.admin.module.business.erp.prp.domain.vo.PrpordaVO;
import net.lab1024.sa.admin.module.business.erp.prp.service.PrpordService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import net.lab1024.sa.base.module.support.operatelog.annotation.OperateLog;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * 生产计划 Controller
 *
 * @Author AKITA
 * @Date 2025-08-08 15:03:13
 * @Copyright AKITA
 */

@OperateLog
@RestController
@Tag(name = "生产计划")
public class PrpordController {

    @Resource
    private PrpordService prpordService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/prpord/queryPage")
    public ResponseDTO<PageResult<PrpordVO>> queryPage(@RequestBody @Valid PrpordQueryForm queryForm) {
        return ResponseDTO.ok(prpordService.queryPage(queryForm));
    }


    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/prpord/queryPageUnexecut")
    public ResponseDTO<PageResult<PrpordVO>> queryPageUnexecut(@RequestBody @Valid PrpordQueryForm queryForm) {
        return ResponseDTO.ok(prpordService.queryPageUnexecut(queryForm));
    }




    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/prpord/queryList")
    public ResponseDTO<List<PrpordaVO>> queryList(@RequestBody PrpordQueryForm query) {
        return prpordService.queryList(query);
    }


    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/prpord/add")
    public ResponseDTO<Long> add(@RequestBody @Valid PrpordAddForm addForm) throws InterruptedException {
        return prpordService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/prpord/update")
    public ResponseDTO<String> update(@RequestBody @Valid PrpordUpdateForm updateForm) {
        return prpordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/prpord/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return prpordService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/prpord/delete/{id}")
    public ResponseDTO<String> batchDelete(@PathVariable Long id) {
        return prpordService.delete(id);
    }

    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/prpord/info/{id}")
    public ResponseDTO<PrpordVO> info(@PathVariable Long id) {
        return prpordService.info(id);
    }


    @Operation(summary = "单个查询 @author AKITA")
    @PostMapping("/prpord/breakDown")
    public ResponseDTO<Long> breakDown(@RequestBody List<PrpordaVO> prpordaVOS) throws InterruptedException {
        return prpordService.breakDown(prpordaVOS);

    }

}
